package com.knife.file;

import java.io.FileWriter;

/**
 * create by yongli on 2021-12-23 11:28
 * 最简单的创建文件，并写入String，追加的方式
 * 同时需要fileWriter.close()或者fileWriter.flush()
 */

public class FileWrite {
    public static void main(String[] args) {
        String path = "/Users/yongli/Desktop/1224-test.txt";
        try {
            FileWriter fileWriter = new FileWriter(path);
            fileWriter.write("in this winter, I learn that how to meet the life");
            // 需要关闭
            fileWriter.close();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
